package com.gxuwz.PangGuangyao.business.dao;

import org.springframework.stereotype.Repository;

import com.gxuwz.PangGuangyao.business.entity.Culum;
import com.gxuwz.PangGuangyao.business.entity.ExpeCata;
import com.gxuwz.core.dao.impl.BaseDaoImpl;
import com.gxuwz.core.pagination.Result;

@Repository("culumDAO")
public class CulumDAO  extends BaseDaoImpl<Culum>{
	/**
	 * 根据条件查找分页
	 * @param Culum 模型
	 * @param page 第几页
	 * @param row 长度
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public Result<Culum> find(Culum culum, int page, int row){
		String hql="from Culum  where 1=1";
		/*if(null != sysRight.getRightName()){
		queryString = queryString + " and rightName like '%"+sysRight.getRightName()+"%'";
		}*/
		int start=(page-1)*row;
		int limit =row;
		return (Result<Culum>)super.find(hql, null, null, start, limit);
	}
	/**
	 * @return
	 * @author lw
	 * @date 2020.02.20
	 * @description:通过课程ID去查找课程
	 */

	public Culum findByCId(Culum culum)
	{
		String hql ="from Culum where CId='"+culum.getCId()+"'";
		return findByHql(hql);
		
		
	}
	/**
	 * @return
	 * @author lw
	 * @date 2020.02.20
	 * @description:添加课程的方法
	 */
	public void add(Culum culum) {
		// TODO Auto-generated method stub
	save(culum)	;
	}
	/**
	 * @return
	 * @author lw
	 * @date 2020.02.20
	 * @description:删除课程的方法
	 */
public void delete(Culum culum) {
	remove(culum);
}	

}
